package com.carl.lambda.annotation;


import org.junit.Test;

import java.lang.reflect.Method;

/**
 * 重复注解与类型注解
 */


public class TestAnnotation {

        @Test
        public void test01() throws Exception{
            Class<TestAnnotation> clazz = TestAnnotation.class;
            Method show = clazz.getMethod("show");
            MyAnnotation[] annotationsByType = show.getAnnotationsByType(MyAnnotation.class);
            for (MyAnnotation myAnnotation : annotationsByType) {
                System.out.println(myAnnotation.value());
            }

        }
        @MyAnnotation()
        @MyAnnotation() //默认传的是MyAnnotation类中定义的值
        public void show(@MyAnnotation("abc") String string){

        }

}
